<h2>DESCRIPTION</h2>

<em>r.series.accumulate</em> calculates (accumulated) raster value 
using growing degree days (GDDs)/Winkler indices's, Biologically 
Effective Degree Days (BEDD), Huglin heliothermal indices or an average 
approach from several input maps for a given day. Accumulation of e.g. 
degree-days to growing degree days (GDDs) can be done by providing a 
<em>basemap</em> with GDDs of the previous day.
<p>
The flag <b>-a</b> determines the average computation of the input raster maps. 
In case the flag is not set, the average calculation is:
<div class="code"><pre>
    average = (min + max) / 2
</pre></div>
In case the flag was set, the calculation changes to arithmetic mean
<div class="code"><pre>
    average = sum(input maps) / (number of input maps)
</pre></div>
<p>
<b>GDD</b> Growing Degree Days are calculated as
<div class="code"><pre>
    gdd = average - lower
</pre></div>
<p>
In case the <b>-a</b> is set, the Winkler indices are calculated instead
of GDD, usually accumulated for the period April 1<sup>st</sup> to October 
31<sup>st</sup> (northern hemisphere) or the period October 
1<sup>st</sup> to April 30<sup>th</sup> 
(southern hemisphere).
<p>
<b>BEDDs</b> Biologically Effective Degree Days are calculated as
<div class="code"><pre>
    bedd = average - lower
</pre></div>
with an optional upper <em>cutoff</em> applied to the average instead of 
the temperature values.
<p>
The <b>Huglin heliothermal index</b> is calculated as
<div class="code"><pre>
    huglin = (average + max) / 2 - lower
</pre></div>
usually accumulated for the period April 1<sup>st</sup> to September 
30<sup>th</sup> (northern hemisphere) or the period September 
1<sup>st</sup> to April 30<sup>th</sup> (southern hemisphere).
<p>
<b>Mean</b> raster values are calculated as
<div class="code"><pre>
    mean = average
</pre></div>
<p>
For all the formulas <em>min</em> is the minimum value, <em>max</em>
the maximum value and <em>average</em> the average value.
The <em>min</em>, <em>max</em> and <em>average</em> values
are automatically calculated from the input maps.
<p>
The <em>shift</em> and <em>scale</em> values are applied directly to 
the input values. The <em>lower</em> and <em>upper</em> maps, as well 
as the <em>range</em> options are applied to constrain the 
accumulation. In case the <em>lower</em> and <em>upper</em> maps are 
not provided the <em>limits</em> option with default values will be 
applied.
<p>
If an existing map is provided with the <em>basemap</em> option, the
values of this map are added to the output.

<h2>NOTES</h2>

The <em>scale</em> and <em>shift</em> parameters are used to transform 
input values with
<div class="code"><pre>
    new = old * scale + shift
</pre></div>
<p>
With the <em>-n</em> flag, any cell for which any of the 
corresponding input cells are NULL is automatically set to NULL 
(NULL propagation) and the accumulated value is not calculated.
<p>
Negative results are set to 0 (zero). 
<p>
Without the <em>-n</em> flag, all non-NULL cells are used for calculation.
<p>
If the <em>range=</em> option is given, any values which fall outside 
that range will be treated as if they were NULL. Note that the range is 
applied to the scaled and shifted input data. The <em>range</em> 
parameter can be set to <em>low,high</em> thresholds: 
values outside of this range are treated as NULL (i.e., they will be 
ignored by most aggregates, or will cause the result to be NULL if -n 
is given). The <em>low,high</em> thresholds are floating point, so use 
<em>-inf</em> or <em>inf</em> for a single threshold (e.g., 
<em>range=0,inf</em> to ignore negative values, or 
<em>range=-inf,-200.4</em> to ignore values above -200.4).
<p>
The maximum number of raster maps that can be processed is given by the 
user-specific limit of the operating system. For example, the soft limits 
for users are typically 1024 files. The soft limit can be changed with e.g. 
<tt>ulimit -n 4096</tt> (UNIX-based operating systems) but it cannot be 
higher than the hard limit. If the latter is too low, you can as superuser
add an entry in:

<div class="code"><pre>
/etc/security/limits.conf
# &lt;domain&gt;      &lt;type&gt;  &lt;item&gt;         &lt;value&gt;
your_username  hard    nofile          4096
</pre></div>

This will raise the hard limit to 4096 files. Also have a look at the 
overall limit of the operating system
<div class="code"><pre>
cat /proc/sys/fs/file-max
</pre></div>
which on modern Linux systems is several 100,000 files.

<p>
Use the <b>-z</b> flag to analyze large amounts of raster maps without
hitting open files limit and the <em>file</em> option to avoid hitting
the size limit of command line arguments.
Note that the computation using the <em>file</em> option is slower
than with the <em>input</em> option.
For every single row in the output map(s) all input maps are 
opened and closed. The amount of RAM will rise linearly with the number 
of specified input maps. The <em>input</em> and <em>file</em> options are
mutually exclusive: the former is a comma separated list of raster map
names and the latter is a text file with a new line separated list of
raster map names.

<h2>EXAMPLES</h2>

Example with MODIS Land Surface Temperature, transforming values from 
Kelvin * 50 to degrees Celsius:
<div class="code"><pre>
r.series.accumulate in=MOD11A1.Day,MOD11A1.Night,MYD11A1.Day,MYD11A1.Night out=MCD11A1.GDD \
      scale=0.02 shift=-273.15 limits=10,30
</pre></div>

<h2>SEE ALSO</h2>

<em>
<a href="g.list.html">g.list</a>,
<a href="g.region.html">g.region</a>,
<a href="r.series.html">r.series</a>,
<a href="r.series.interp.html">r.series.interp</a>
</em>
<p>
<a href="https://grasswiki.osgeo.org/wiki/Large_raster_data_processing">Hints for large raster data processing</a>

<h2>REFERENCES</h2>

<ul>
<li> Jones, G.V., Duff, A.A., Hall, A., Myers, J.W., 2010.
     Spatial analysis of climate in winegrape growing regions in the 
     Western United States. Am. J. Enol. Vitic. 61, 313-326.</li>
</ul>


<h2>AUTHORS</h2>

Markus Metz and Soeren Gebbert (based on r.series)

<!--
<p>
<i>Last changed: $Date$</i>
-->
